# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Laurent Carlier <lordheavym@gmail.com>

pkgname=glu
pkgver=9.0.2
pkgrel=3
pkgdesc="Mesa OpenGL utility library"
arch=('x86_64')
url="https://gitlab.freedesktop.org/mesa/glu"
license=('LGPL')
depends=('libgl')
makedepends=('meson')
options=('debug')
source=(https://mesa.freedesktop.org/archive/glu/glu-$pkgver.tar.xz{,.sig}
        0001-pkgconfig-Depend-on-opengl-when-built-with-libglvnd.patch
        0002-pkgconfig-Drop-unneeded-lines-from-autotools-build.patch
        0003-pkgconfig-meson-build-should-match-autotools-require.patch)
sha512sums=('2517d7406bb643d12c017a95dcb5d8716f307344332638bcbdf274a90752a7c22165d34745f1b082ed916bb07d40e62d1d1d67d96426225be63166f3480d6f64'
            'SKIP'
            'c6fe65e9505c37f94f6c136dc1ad5aac62828bb0d60d7cf887743521ba030b64c63111713c54c77480b79d9fa0fe9424074c59b391ec385b6ed2867cf03e5128'
            '132184fd813c20a5dcd5357bb651e42f9df9bd8ed5d6cfe60e0956d74854863210bdf5a498f5f0c60122cafb34389bc4c4d288c66d793c4be11ab25781c44881'
            '972518b5363c7768655ae7a18d31faf42ebeae8be3408edbebbe021b17300cec366b091b82c880422052ba469ec6569ecb07b0741b2560822c578e13dce8c098')
validpgpkeys=('3BB639E56F861FA2E86505690FDD682D974CA72A') # "Matt Turner <mattst88@gmail.com>"

prepare() {
  cd glu-$pkgver

  # merged upstream
  patch -Np1 -i ../0001-pkgconfig-Depend-on-opengl-when-built-with-libglvnd.patch
  patch -Np1 -i ../0002-pkgconfig-Drop-unneeded-lines-from-autotools-build.patch
  patch -Np1 -i ../0003-pkgconfig-meson-build-should-match-autotools-require.patch
}

build() {
  arch-meson glu-$pkgver build \
    -D default_library=shared

  # Print config
  meson configure build

  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
}
